package zhtest;

import java.util.concurrent.atomic.AtomicInteger;

public class TestAtomicIntegger {
    private AtomicInteger count = new AtomicInteger();
    public void increment() {
        count.incrementAndGet();

    }
    public int getCount() {
        return count.get();
    }

    public static void main(String[] args) {
        TestAtomicIntegger testAtomicIntegger = new TestAtomicIntegger();
       testAtomicIntegger.increment();
        int count = testAtomicIntegger.getCount();
        testAtomicIntegger.increment();

        int count1 = testAtomicIntegger.getCount();
        System.out.println(count);
        System.out.println(count1);
    }
}
